import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
//导师端
import Login from '@/components/web/Login'
import selectPostion from '@/components/web/selectposition'
import selectCourse from '@/components/web/selectCourse'
import course from '@/components/web/course'
import updata from '@/components/web/updata'
import datacheck from '@/components/web/datacheck'
import editpwd from '@/components/web/editpwd'
import coursedetail from '@/components/web/coursedetail'
import error from '@/components/web/error'



//后台管理
import index from '@/components/admin/index'
import header from '@/components/admin/header'
import aside from '@/components/admin/aside'
import main from '@/components/admin/main'
import coursemanage from '@/components/admin/coursemanage'
import editcourse from '@/components/admin/editcourse'
import editchapters from '@/components/admin/editchapters'
import teachermanage from '@/components/admin/teachermanage'
import editteacherinfo from '@/components/admin/editteacherinfo'
import adminmanage from '@/components/admin/adminmanage'
import editadmininfo from '@/components/admin/editadmininfo'
import stsumdata from '@/components/admin/stsumdata'
import stdtldata from '@/components/admin/stdtldata'
import interaction from '@/components/admin/interaction'
import examimport from '@/components/admin/examimport'
import editpasssword from '@/components/admin/editpasssword'
import coursematerials from '@/components/admin/coursematerials'
import examconfig from '@/components/admin/examconfig'
import studentinfolist from '@/components/admin/studentinfolist'
import studentinfoedit from '@/components/admin/studentinfoedit'



//手机端
import applogin from '@/components/app/applogin'
import appresign from '@/components/app/appresign'
import findpwd from '@/components/app/findpwd'
import courseinteract from '@/components/app/courseinteract'
import datacenter from '@/components/app/datacenter'
import exam from '@/components/app/exam'
import appmain from '@/components/app/main'
import experience from '@/components/app/experience'
import personcenter from '@/components/app/personcenter'
import singup from '@/components/app/singup'
import exampage from '@/components/app/exampage'
import examend from '@/components/app/examend'
import interactanswer from '@/components/app/interactanswer'
import interactend from '@/components/app/interactend'
import apperror from '@/components/app/apperror'



Vue.use(Router)

const router =  new Router({
  routes: [
    //导师端
    {path: '/login',name: 'Login',component: Login},
    // {path:'/',redirect:'/Login'},//指定打开首页显示的页面
    {path:'/selectPosition',name:'selectPosition',component: selectPostion},
    {path:'/selectCourse',name:'selectCourse',component: selectCourse,
        children:[
          {path:'/',redirect:'/selectCourse/course'},
          {path:'course',name:'course',component:course},
          {path:'updata',component:updata},
          {path:'datacheck',component:datacheck},
          {path:'editpwd',component:editpwd},
        ]
      
    },
    {path:'/coursedetail',name:'coursedetail',component: coursedetail},
    {path:'/error',name:'error',component: error},


    //管理端路由
    {path:'/index',name:'index',component: index,meta:{auth:true},
    children:[
      {path:'/',redirect:'main'},
      {path:'main',component:main},
      {path:'/coursemanage',name:'coursemanage',component: coursemanage},
      {path:'/coursemanage/editcourse',name:'editcourse',component: editcourse},
      {path:'/coursemanage/editchapters',name:'editchapters',component: editchapters},
      {path:'/teachermanage',name:'teachermanage',component: teachermanage},
      {path:'/adminmanage',name:'adminmanage',component: adminmanage},
      {path:'/editteacherinfo',name:'editteacherinfo',component: editteacherinfo},
      {path:'/editadmininfo',name:'editadmininfo',component: editadmininfo},
      {path:'/stsumdata',name:'stsumdata',component: stsumdata},
      {path:'/stdtldata',name:'stdtldata',component: stdtldata},
      {path:'/interaction',name:'interaction',component: interaction},
      {path:'/examimport',name:'examimport',component: examimport},
      {path:'/examconfig',name:'examconfig',component: examconfig},
      {path:'/editpasssword',name:'editpasssword',component: editpasssword},
      {path:'/coursematerials',name:'coursematerials',component: coursematerials},
      {path:'/studentinfolist',name:'studentinfolist',component: studentinfolist},
      {path:'/studentinfoedit',name:'studentinfoedit',component: studentinfoedit},
    ]},
    {path:'/admin/header',name:'header',component: header},
    {path:'/admin/aside',name:'aside',component: aside},
    {path:'/admin/main',name:'main',component: main},
    //{path:'/admin/stsumdata',name:'stsumdata',component: stsumdata},
    //{path:'/admin/admin',component: admin}



    //手机端路由
    {path:'/applogin',name:'applogin',component:applogin},
    {path:'/appresign',name:'appresign',component:appresign},
    {path:'/findpwd',name:'findpwd',component:findpwd},
    {path:'/courseinteract',name:'courseinteract',component:courseinteract},
    {path:'/datacenter',name:'datacenter',component:datacenter},
    {path:'/exam',name:'exam',component:exam},
    {path:'/appmain',name:'appmain',component:appmain},
    {path:'/experience',name:'experience',component:experience},
    {path:'/personcenter',name:'personcenter',component:personcenter},
    {path:'/singup',name:'singup',component:singup},
    {path:'/exampage',name:'exampage',component:exampage},
    {path:'/examend',name:'examend',component:examend},
    {path:'/interactanswer',name:'interactanswer',component:interactanswer},
    {path:'/interactend',name:'interactend',component:interactend},
    {path:'/apperror',name:'apperror',component:apperror},
    
  ]
})

// router.beforeEach((to, from, next) => {
//   console.log(to)
//   if (to.path === '/login') {
//     next()
//   } else {
//     const token = localStorage.getItem('token')
//     if (token) {
//       next()
//     } else {
//       // 没有，登录失败
//       next('/login')
//     }
//   }
// })
export default router
